package com.github.wxiaoqi.security.biz.modules.community.rest;

import java.util.Map;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.wxiaoqi.security.biz.common.cms.request.CmsTopicQueryParam;
import com.github.wxiaoqi.security.biz.common.cms.request.CmsTopicRequestParam;
import com.github.wxiaoqi.security.biz.modules.community.biz.CmsTopicBiz;
import com.github.wxiaoqi.security.biz.modules.community.entity.CmsTopic;
import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;

import lombok.extern.slf4j.Slf4j;

/**
 * 话题-对内
 * @author Administrator
 *
 */
@Slf4j
@Controller
@RequestMapping("cmsTopic")
public class CmsTopicRestController extends BaseController<CmsTopicBiz,CmsTopic> {

	
	/**
	 * 列表
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/list", method = RequestMethod.POST)
	public TableResultResponse<CmsTopic> query(@RequestBody CmsTopicQueryParam param) {
		log.info("查询所有话题------start------{}", param);
		param.setPlatformId(setPlatformId(param.getPlatformId()));
		return baseBiz.queryCmsTopics(param);
	}
	
	/**
	 * 添加
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/add", method = RequestMethod.POST)
	public Map<String, Object> add(@RequestBody CmsTopicRequestParam param) {
		log.info("添加话题------start------{}", param);
		return baseBiz.addCmsTopic(param);
	}
	
	/**
	 * 修改
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/update", method = RequestMethod.POST)
	public Map<String, Object> update(@RequestBody CmsTopicRequestParam param) {
		log.info("修改话题------start------{}", param);
		return baseBiz.updateCmsTopic(param);
	}
	
	/**
	 * 删除
	 * @param param
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/delete", method = RequestMethod.POST)
	public Map<String, Object> delete(@RequestBody CmsTopicRequestParam param) {
		log.info("删除话题------start------{}", param);
		return baseBiz.deleteCmsTopic(param);
	}
}